// import request from '@/utils/request'
import {request} from '@/plugins/request'

export const getArticles = (params)=>{
    return request({
        url:'/api/articles',
        method:'get',
        params
    })
}

export const getFeedArticles = (params)=>{
    return request({
        url:'/api/articles/feed',
        method:'get',
        params
    })
}

export const addFavorite = slug=>{
    return request({
        url: `/api/articles/${slug}/favorite`,
        method:'post'
    })
}

export const deleteFavorite = slug=>{
    return request({
        url: `/api/articles/${slug}/favorite`,
        method:'delete'
    })
}

export const getArticle = slug =>{
    return request({
        url: `/api/articles/${slug}`,
        method: 'get'
    })
}

export const getComments= slug =>{
    return request({
        url: `/api/articles/${slug}/comments`,
        method: 'get'
    })
}







